home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-04-08 | 31.5 KB | 1,329 lines |
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
- BROWSING WITHOUT CHANGING
-
- DATE : 03/86 NUMBER : EX-3-1
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : BROWSE SUBCATEGORY : NO CHANGES/VIEW ONLY
-
- ________________________________________________________
-
- DESCRIPTION: I want to be able to browse through my database both
- forward and backward without changing any of the data.
-
-
-
-
- SOLUTION: Here are two methods you can use to browse through your
- data without changing the original data. Method one uses the EDIT ALL
- command with a modify password. Method two uses report formats and
- displays one row at a time on the screen. All macros and command
- files should be put on your database directory with your database.
-
- METHOD ONE - MODIFY PASSWORD
-
- The EDIT ALL command in R:base allows easy browsing both forward and
- backward in your table without using a form. In addition, the EDIT
- ALL command allows you to view several rows of data at one time and to
- scroll to the right and left as well as up and down. To prevent
- inadvertant changes to your data, put a modify password (MPW) on all
- tables that you want to be able to browse through without changing.
- Then, when you want to actually make changes to the table, enter the
- modify password with the USER command. After making your changes, use
- the USER command again to change the current system password to
- something other than the modify password.
-
- For example, the following code will put a modify password of GOFORIT
- on a table named CLIENTS in a database named MYDB where the OWNER
- password is SMITH:
-
- DEFINE MYDB
- OWNER SMITH
- PASSWORDS
- MPW FOR CLIENTS IS GOFORIT
- END
-
- After defining the passwords for the first time, you will need to exit
- from R:base and then reload R:base before the passwords will be
- effective.
-
- Finally, use the following code anytime you want to browse or make
- changes to the table CLIENTS:
-
- FILLIN CHOICE USING +
- "Enter B to browse through CLIENTS or enter C to make a change to
- CLIENTS: "
-
-
-
-
-
-
-
-
-
-
-
- IF CHOICE = B THEN
- USER NONE
- EDIT ALL FROM CLIENTS
- ENDIF
- IF CHOICE = C THEN
- USER GOFORIT
- EDIT ALL FROM CLIENTS
- USER NONE
- ENDIF
-
- Be sure to set up an OWNER password before setting up modify passwords
- and take care to keep a record of what your owner password is. If you
- lose your OWNER password, you will no longer be able to add or change
- passwords nor will you be able to modify your database structure.
-
- METHOD TWO - REPORTS
-
- This method will allow you to browse through your data one row at a
- time. First, Make a report that looks exactly like your form. See
- MICRORIM TECHNICAL NOTE NUMBER EX-3-6 (CATEGORY: REPORTS and
- SUBCATEGORY: FROM FORMS) in this March 1986 set for a macro that will
- quickly convert your table form to an identical report format.
-
- Now when you want to browse through your data, form by form, issue the
- following command to print the report to the screen:
-
- PRINT repname
-
- If you want only certain records displayed, put a WHERE clause on the
- PRINT command line.
-
- GOING FORWARD AND BACKWARD
-
- If you want to browse both forward and backward quickly, you will need
- a ROWNUM column in your table. Make sure the ROWNUM column contains
- unique consecutive row numbers and that it is a keyed column for fast
- access. In other words, your row numbers should not have gaps; if you
- have a row number three, there should be a two and a one. If there is
- a missing number, the macro LOOKONLY.MAC (listed below) will print the
- message, "WARNING, NO ROWS SATISFY THE WHERE CLAUSE".
-
- For an automatic row numbering routine, see page 10 of the November
- 1985 R:base EXCHANGE.
-
- To run the following macro, issue the following command:
-
- RUN LOOKONLY.MAC
-
- *( LOOKONLY.MAC - a macro that will allow browsing forward and
- backward, one
- form {or row} at a time, without allowing changes to the data)
- SET VAR NEXTROW TO N
- SET VAR START INTEGER
- FILLIN START USING "Enter the starting row number or +
- press [ENTER] for the beginning: "
-
-
-
-
-
-
-
-
-
-
-
-
- *( If the operator presses [ENTER] we start at the beginning )
- IF START FAILS THEN
- SET VAR START TO 1
- ENDIF
-
- COMPUTE TOTROWS AS ROWS FROM tblname
- SET VAR TOTROWS TO .TOTROWS + 1
-
- *( This loop prints the records on the screen )
- WHILE NEXTROW NE Q OR START NE 0 OR START NE .TOTROWS THEN
- PRINT repname WHERE ROWNUM = .START
- FILLIN NEXTROW USING +
- "Enter N for the next row, P for the previous row, or Q to quit: "
-
- *( Add 1 to see the {N}ext row, subtract 1 to see the {P}revious row)
- GOTO .NEXTROW
-
- LABEL N
- SET VAR START TO .START + 1
- GOTO THEEND
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- LABEL P
- SET VAR START TO .START - 1
- GOTO THEEND
-
- LABEL Q
- QUIT
-
- LABEL .NEXTROW
-
- LABEL THEEND
- ENDWHILE
-
- In the above code the line:
-
- LABEL .NEXTROW
-
- is necessary to protect against an operator entering something other
- than a P, N, or Q. If you omit this line of code and an operator
- enters an M instead of an N, the LOOKONLY.MAC program will go into an
- infinite loop looking for a label that does not exist. To the
- operator the computer will appear to be hanging.
-
- Also, take a look at the WHILE... command line. Control will pass out
- of the WHILE loop if:
-
- o The operator presses Q to quit (NEXTROW = Q).
- o The operator is on the first row and presses P for the previous
- row (START = 0).
- o The operator is on the last row and presses N for the next row
- (START = .NEXTROW).
-
- If you do not want to add a ROWNUM column to your table, change the
- PRINT command line in the above listing of LOOKONLY.MAC to read:
-
- PRINT repname WHERE COUNT = .START
-
- This will use a built-in feature of R:base, but will not be as fast if
- you are working with a large table of data.
-
- You may want to modify LOOKONLY.MAC to better meet your exact needs.
- You could, for example, ask the operator how many rows to go back or
- put in a menu with options such as 10 rows back, 20 rows back, 10 rows
- forward, etc. You can make many interesting modifications. To
- increase execution speed, GOTOs and LABELs are used instead of stacked
- IF blocks.
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- MORE THAN 10 CONDITIONS IN A RULE
-
-
-
-
-
-
-
-
-
-
-
-
- DATE : 03/86 NUMBER : EX-3-2
- PRODUCT : R5K & R4K VERSIONS : 4K 1.15 & 5K 1.01
- CATEGORY : RULES SUBCATEGORY : CONDITIONS
-
- ________________________________________________________
-
- DESCRIPTION: I need more than 10 conditions in my RULE. I know I
- could set up a table with all needed conditions and then check that
- table but I would rather be able to put the conditions directly into
- the RULE.
-
-
-
-
- EXPLANATION: To understand how to create more than 10 conditions in
- a single rule, it is necessary to understand how R:base stores rules.
-
- All rules are stored as data in the RULES table in R:base 5000 or in
- the RBSRULES table in R:base 4000. If you have R:base 4000,
- substitute the table name RBSRULES for RULES throughout this technical
- note.
-
- Each condition of a rule is stored in a separate row of the table, and
- conditions are separated by either an AND or an OR. The columns in
- the RULES/RBSRULES table are described below.
-
- NUMRULE (INTEGER): number of the rule
-
- AND/OR (TEXT): contains AND if this is the first condition of the
- rule, either AND or OR for subsequent conditions
- (depending on how you separated them). If this is
- the last row(s) of the rule, this column contains
- the word USES
-
- COLNAME1 (TEXT): contains the name of the column that this condition
- of the rule checks.
-
- TABLE1 (TEXT): This column is blank except on the row(s) where the
- AND/OR column contains the word USES. In that
- case, TABLE1 contains the name of the table that
- COLNAME1 is in. If COLNAME1 is in more than one
- table, there will be a row for every table name.
-
- BOOLEAN (TEXT): contains the operator for the rule:
- = or EQ : column1 equals a value
- < or LT : column1 less than a value
- > or GT : column1 greater than a value
- <> or NE : column1 not equal to a value
- <= or LE : column1 less than or equal to a value
- >= or GE : column1 greater than or equal to a value
- EQA : column1 equals column2 in table2
- LTA : column1 less than column2 in table2
- GTA : column1 greater than column2 in table2
- NEA : column1 not equal to column2 in table2
- LEA : column1 less than or equal to
-
-
-
-
-
-
-
-
-
-
-
- column2 in table2
- GEA : column1 greater than or equal to
- column2 in table2
- EXIS : column1 exists
- FAIL : column1 fails (contains NULL)
-
- COLNAME2 (TEXT): contains the name of the second column of the
- comparison if BOOLEAN is EQA, NEA, LTA, GTA, GEA,
- or LEA.
-
- TABLE2 (TEXT): contains the name of the table that COLNAME2 is in.
-
- RULVALUE (TEXT): contains the value to compare COLNAME1 to if the
- comparison is =, <, >, <>, <= or >= (or their
- two-letter equivalents.) If this is the last row
- of the rule and AND/OR contains the word USES, this
- column contains the error message text.
-
- What follows is an example of how rules are parsed when entered in
- DEFINE mode:
-
- Look at the following two table definitions:
-
- Table: TAB1
- Column definitions:
- # Name Type Length
- 1 ID Integer 1 value(s)
-
- Table: TAB2
- Column definitions:
- # Name Type Length
- 1 ID Integer 1 value(s)
- 2 NAME Text 24
-
- The following three rules are defined for this database:
-
- "Bad ID" ID = 1 OR ID = 0
- "Dupe" ID IN TAB1 NEA ID IN TAB2
- "Bad Combo" NAME = DR AND ID LT 0
-
- The RULES table for this example is shown below:
-
- NUMRULE AND/OR COLNAME1 TABLE1 BOOLEAN COLNAME2 TABLE2 RULVALUE
- ------- ------ -------- ------ ------- -------- ------ --------
- 1 ANDS ID = 1
- 1 OR ID = 0
- 1 USES TAB1 Bad ID
- 1 USES TAB2 Bad ID
- 2 AND ID TAB1 NEA ID TAB2
- 2 USES TAB1 Dupe
- 3 AND NAME = DR
- 3 AND ID LT 0
- 3 USES TAB2 Bad Combo
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SOLUTION: R:base 4000 and R:base 5000 do not allow you to define
- more than 10 conditions in a single rule but you can work around this
- by manipulating the RULES table directly. Using this method you may
- have as many conditions in a single rule as you need. However, you
- need to be sure that your logic is correct. The method presented here
- will work best if you have all ORs or all ANDs in your rule. Mixing
- ANDs and ORs in a single rule can create computer logic problems.
-
- While in DEFINE mode, R:base will only let you define 10 conditions
- for a rule. However, you can manually load the RULES table with as
- many conditions as you want. However, the rule to which you are
- adding conditions must be the physically last rule in the RULES table.
-
- STEP ONE
-
- Define the first 10 conditions of the rule using the DEFINE command.
-
- STEP TWO
-
- Exit DEFINE mode and project (into a temporary table) the row or rows
- for your rule containing the word "USES" in the AND/OR column. Then
- delete the same row(s) from the RULES table. For example, the
- following two command lines will work for rule number three above.
-
- PROJECT TEMP FROM RULES USING ALL WHERE NUMRULE = 3 AND AND/OR = USES
- DELETE ROWS FROM RULES WHERE NUMRULE = 3 AND AND/OR = USES
-
-
- STEP THREE
-
- You can now use LOAD RULES WITH PROMPTS to load the RULES table with
- as many conditions as you want. Any unused columns in the RULES table
- must be filled with at least one space. No NULL values can be in any
- of the columns of the RULES table. You must actually enter the space
- into the column; simply setting NULL to a space with the SET NULL " "
- command will not work.
-
- STEP FOUR
-
- The last row of the rule must have "USES" in the AND/OR column and
- your error message in the RULVALUE column. It must look exactly like
- the row(s) you deleted in STEP TWO above. Because this last row is
- stored in the temporary table you projected, it is easy to reattach it
- by using the APPEND command:
-
- APPEND TEMP TO RULES
-
- By experimenting with various conditions, logical operators, etc., it
- is possible to define rules with as many conditions as you want. One
- user has reported personally testing this method with 100 conditions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- CREATING A FORMATTED FILE WIDER THAN 131
-
- DATE : 03/86 NUMBER : EX-3-3
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : FILES SUBCATEGORY : FORMATTED
- FILES/SELECT
-
- ________________________________________________________
-
- DESCRIPTION: I need a formatted ASCII file wider than 131 characters
- (the limit on the R:base 5000 report writer) to be able to load data
- coming from my R:base database into my mainframe computer.
-
-
-
-
- SOLUTION: Using the SELECT command you can create a formatted ASCII
- file wider than 131 characters. You can, in fact, go as wide as 256
- characters with this method.
-
- The code listed below demonstrates how to create a formatted file
- named FORMFILE.DAT that is 250 characters wide.
-
- SET ERROR MESSAGE OFF
- SET MESSAGE OFF
- SET ECHO OFF
-
- *(Set lines to 0 so that the heading will print only once and will be
- easy to remove)
- SET LINES 0
-
- SET WIDTH 250
- OUTPUT FORMFILE.DAT
-
- *(Print the selected columns, using the =w option to format the file.
- Keep in mind that SELECT will always print one blank before printing
- each column; for example, COL1 will begin printing in position two
- and COL2 will begin printing in position 73. Also remember that
- TEXT datatypes are left justified and all other data types are right
- justified.)
- SELECT COL1=70 COL2=20 COL3=70 COL4=16 COL5=70 FROM tblname
- OUTPUT SCREEN
-
- After creating the file with the above code you may want to remove the
- first two lines of the file. These two lines contain the heading
- produced by the SELECT command. Use an editor or word processor under
- nonformat or nondocument mode.
-
- To create a file wider than 256 characters or with a specialized
- format, use our Extended Report Writer (XRW). XRW is available from
- your local software dealer.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- FORMS LAYOUT AND CHANGING THE PROMPT ORDER
-
- DATE : 03/86 NUMBER : EX-3-4
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : FORMS SUBCATEGORY : LAYOUT & PROMPT
- ORDER
-
- ________________________________________________________
-
- DESCRIPTION: How can I change the order, on a form, by which the
- operator is prompted to enter data? Also, please explain the numbers
- in the forms layout section.
-
-
-
-
- EXPLANATION: All forms are stored as data in a table named FORMS.
- The FORMS table has two columns, FNAME and FDATA. FNAME contains the
- formname for a particular form. All the rows for a particular form
- have the same FNAME value. The first row for the form contains the
- name of the table (if a table form) in the FDATA column. If the form
- is a variable form, the FDATA column in the first row will be blank.
- After the first row, the next group of rows for the variable or table
- form contain all the textual information associated with the form.
- Following these rows is the LAYOUT section for the form. The LAYOUT
- section contains information about the locations of the columns or
- variables in the form.
-
- Open your database and issue the command:
-
- SELECT ALL FROM FORMS
-
- Page down until you see the word LAYOUT in the right-hand column
- (FDATA column). Immediately below the word LAYOUT you will see the
- column or variable names that are located on that form.
-
- If this is a table form, you will see three numbers to the right of
- each column name listed under the word LAYOUT. For example, here is
- the LAYOUT section of a table form named CALLNOTE.
-
- CALLNOTE LAYOUT
- CALLNOTE CONTACT 13 8 24
- CALLNOTE SPOKEWIT 13 51 24
- CALLNOTE IDNO 12 8 10
-
- Underneath the word LAYOUT are the column names CONTACT, SPOKEWIT, and
- IDNO. The order in which they are listed determines the prompting
- order. When entering or editing data using this form, the cursor will
-
-
-
-
-
-
-
-
-
-
-
- first go to CONTACT, then bounce to SPOKEWIT, and finally bounce to
- IDNO.
-
- The three numbers next to each column name refer to the location of
- that particular column on the form. The first is the starting line
- number of the S...E location. The second is the starting position of
- the S...E on the line. The third is the located length. In the
- CALLNOTE form, the column SPOKEWIT is located on the 13th line of the
- screen beginning in the 51st position and it is 24 characters long
- (including the S, the E, and the 22 positions inbetween).
-
- Variable forms have four numbers to the right of each of the variable
- names. For example, the following is the LAYOUT section of a variable
- form named ONLINE:
-
- ONLINE LAYOUT
- ONLINE REGDATE 10 3 8 4
- ONLINE REGNO 10 22 7 1
- ONLINE NAME 13 8 24 -24
- ONLINE CO 14 8 30 -30
- ONLINE CALLTIME 6 72 6 5
-
- When entering or editing data using this ONLINE variable form, the
- curser will bounce from REGDATE to REGNO to NAME to CO and finally to
- CALLTIME each time the [ENTER] key is pressed.
-
- With variable forms, there is a fourth number listed. This fourth
- number is a code indicating the data type of the variable or, in the
- case of TEXT datatypes, it is the negative of the defined length of
- text variables. Notice that only the TEXT datatype variables have a
- minus sign in this column. The codes are as follows:
-
- 1 INTEGER
- 2 REAL
- 4 DATE
- 5 TIME
- 6 DOLLAR
- -n TEXT (Where n is the
- defined length of
- the text variable)
-
- In the ONLINE variable form above, the variable CALLTIME is located on
- the variable form beginning on line six, position 72. Its located
- length is six positions and its datatype is TIME. The location of the
- variable CO begins on line 14 in the eighth position. The variable CO
- is defined as a TEXT datatype and both its located and defined lengths
- are 30. Any easy way to remember which length is which is to remember
- that the positive number is the located length and the negative number
- is the defined length.
-
- An important aside is that both the defined and located lengths should
- probably be the same. If you want to change the defined length to
- match the located length, issue the following command:
-
- EDIT ALL FROM FORMS +
-
-
-
-
-
-
-
-
-
-
-
- WHERE FNAME = formname
-
- Using the down arrow key find the LAYOUT section and the variable name
- beneath it. Using the right arrow, move to the negative number and
- type over it to make it the negative of the number immediately to its
- left. For example, if the negative number is -8 and the number to the
- left of it is 5, then move the cursor to the -8 and change it to -5.
-
-
-
-
- SOLUTION: To change the bounce order of the cursor, you need to
- change the order of the lines listed in the LAYOUT section. For
- example, to change the CALLNOTE table form to have the cursor go to
- IDNO first, then CONTACT, and finally SPOKEWIT, you need to make the
- list under LAYOUT look like this:
-
- CALLNOTE LAYOUT
- CALLNOTE IDNO 12 8 10
- CALLNOTE CONTACT 13 8 24
- CALLNOTE SPOKEWIT 13 51 24
-
- Notice that none of the numbers associated with a particular column
- name changed. The only change is that the IDNO line is now on the top
- of the stack.
-
- There are several different ways to accomplish this reordering:
-
- o RUN a macro named REORDER.FM. It is too long to include in this
- Technical Note but, if you have a modem, you can download it from
- the Microrim Electronic Bulletin Board. You will find REORDER.FM in
- the FILES section - R5KAPPS area. If you do not have a modem, call
- (206) 885-2000 and ask for the Customer Support INFO CENTER. We
- will mail you a listing.
-
- o Using the FORMS command, delete all the current locations, and
- then locate them again in the order you want. This method is the
- easiest to understand but takes a long time.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- o If you do not have quotes in your form, issue the following
- commands after backing up the database:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SET NULL -0-
- OUTPUT TEMP.DAT
- UNLOAD DATA FOR FORMS +
- WHERE FNAME = formname
- OUTPUT TERMINAL
- DELETE ROWS FROM FORMS +
- WHERE FNAME = formname
-
-
- If you do have quotes in the edited text of your form, you will need
- to choose a character that is not in your form such as the circumflex
- (^) and issue the following command prior to running the above code:
-
- SET QUOTES=^
-
- Now use a word processor under nondocument or nonformat mode to
- reorder the list in the TEMP.DAT file. Do not change any of the
- numbers associated with each name. What you need to do is change the
- position of the entire line in the list. Take care that you move the
- entire line, not just the names.
-
- When you are done, use the code below to put your form back in the
- FORMS table. Omit the top and bottom lines if you did not unload with
- quotes set to the circumflex.
-
- SET QUOTES=^
- SET NULL -0-
- INPUT TEMP.DAT
- SET QUOTES="
-
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- BLINKING VARIABLES
-
- DATE : 03/86 NUMBER : EX-3-5
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : VARIABLE CATEGORY : SCREEN BLINKING
-
- ________________________________________________________
-
- DESCRIPTION: After prompting the operator to enter information on
- the screen by using a FILLIN command, I want to write a message on the
- screen that includes the value just entered and I want that value to
- blink on and off to draw the operator's attention.
-
-
-
-
- SOLUTION: You can have the value of the variable blink on the screen
-
-
-
-
-
-
-
-
-
-
-
- as many times as you want by putting your WRITE and SHOW VAR commands
- inside a WHILE loop.
-
- For example, the following code asks for an ID number to delete and
- then asks the operator if that is the correct number to delete. The
- value of the variable holding the ID will blink on and off nine times
- to draw the operator's attention to the value. Note that this example
- assumes that the ID# is three characters wide and so five blank spaces
- are inserted between Is and the on the WRITE... command line.
-
- *(BLINK.CMD)
- NEWPAGE
- FILLIN VID USING "Enter ID# to delete: " at 5,10
- SET VAR BLINKNUM TO 0
- WHILE BLINKNUM LT 10 THEN
- WRITE "Is the ID# you want to delete? (Y/N) " AT 7,10
- SHOW VAR VID=3 AT 7,13
- SET VAR BLINKNUM TO .BLINKNUM + 1
- ENDWHILE
- FILLIN ANSWER USING "" AT 7,51
-
- *( If it is the correct number, delete it )
- IF ANSWER = Y THEN
- DELETE ROW FROM tblname WHERE ID# = .VID
- ENDIF
-
- Notice that the reason why the variable's value blinks on and off is
- because each time the WRITE command is executed, it blanks out the
- value of the variable momentarily. You could have the entire line
- blink by putting the following command as the first command in the
- WHILE loop:
-
- WRITE " " AT 7,10
-
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- CONVERTING TABLE FORMS TO REPORTS
-
- DATE : 03/86 NUMBER : EX-3-6
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : REPORTS SUBCATEGORY : FROM FORMS
-
- ________________________________________________________
-
- DESCRIPTION: I have developed a fancy table form using the R:base
- FORMS command. It took a lot of effort to put in the fancy boxes and
- to locate all the columns. Now I want a report that looks just like
- it; is there an easy way to copy my form into a report?
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- EXPLANATION: The FORMS and REPORTS tables are laid out differently
- so it is necessary to run a conversion routine to convert your FORMS
- to REPORTS. The macro FORM2REP.MAC presented below will take your
- form and make a report that matches it exactly.
-
- FORM2REP.MAC requires that the REPORTS table already exists and that
- your original form is a maximum of 79 character positions wide. If
- there is anything in character position 80 of your form, FORM2REP.MAC
- will cause a blank line to be inserted into your report.
-
- If your form has fancy boxes and you want to print the report to the
- printer instead of the screen, you may need to modify the report to
- remove the fancy box lines and put in other characters that your
- printer can recognize such as the dash, the asterisk, or the
- underline. Some printers are smart enough to recognize the fancy
- boxes that you entered in your form by using the [ALT] key, but most
- of the less expensive printers will not.
-
- Run the macro listed in the SOLUTION below without modification. It
- is critical that the layout portions of both the forms and reports
- match the layout that R:base expects.
-
- You can use your new report format for the following purposes:
-
- o To print blank forms, to be used as source documents. You can
- use the following code after replacing the word tblname with the
- actual name of the table associated with your form and the word
- repname with the actual name of your report:
-
- SET NULL -0-
- LOAD tblname
- FILL
- -0-
- END
- SET NULL " "
- PRINT repname WHERE COUNT = LAST
- SET NULL -0-
- DELETE ROW FROM tblname WHERE COUNT = LAST
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- o To browse through your data without fear of accidently changing
- it. See technical note EX-3-1 Browsing Without Changing (category:
- BROWSE - subcategory: NO CHANGES/VIEW ONLY) for details.
-
- o To easily print hard copies or a file listing of all your records
- with one record per form. These listings may be used to meet
- archival, backup & recovery, and audit trail requirements.
-
-
-
-
- SOLUTION:
-
-
- *( FORM2REP.MAC )
- *( A macro that copies a form to a report format )
-
- CLEAR ALL VARIABLE
- SET MESSAGE OFF
- SET ERROR MESSAGE OFF
- NEWPAGE
- LIST FORMS
- SET VAR VFNAME TEXT
- FILLIN VFNAME USING +
- "Enter the name of the form to convert or press [ENTER] to quit: "
- IF VFNAME FAILS THEN
- QUIT
- ENDIF
-
- *( See if the report already exists )
- SET POINTER #3 S3 FOR REPORTS WHERE RNAME = .VFNAME
- IF S3 EQ 0 THEN
- WRITE "A report with the same name already exists"
- WRITE "Press any key to quit"
- PAUSE
- QUIT
- ENDIF
- SET CLEAR OFF
-
- *( Cycle through the form moving data to the report )
- SET POINTER #2 S2 FOR FORMS WHERE FNAME = .VFNAME
- SET VAR TEMP TEXT
- SET VAR COUNTER TO 0
- SET VAR LAY TO NO
- WHILE S2 EQ 0 THEN
- SET VAR VFDATA TO FDATA IN #2
- WRITE .VFDATA *( Show the user it is processing )
- SET VAR COUNTER TO .COUNTER + 1
- IF COUNTER EQ 1 THEN
- *( Note that there are five spaces between the PAGESIZE and the 1
- on the
- third line following this comment. These spaces are important
- and
- must be there )
- LOAD REPORTS
-
-
-
-
-
-
-
-
-
-
-
- .VFNAME .VFDATA
- .VFNAME "PAGESIZE 1"
- .VFNAME VARIABLE
- .VFNAME DETAIL
- END
- ENDIF
- IF COUNTER GT 1 THEN
- IF LAY EQ YES THEN
- *( Note: The line following this comment has five spaces between
- the
- open quote and the 1, five spaces between the 1 and the 0 and
- five
- spaces between the two 0s. These spaces are important and
- must be
- there )
- SET VAR TEMP TO .VFDATA + " 1 0 0"
- LOAD REPORTS
- .VFNAME .TEMP
- END
- ENDIF
- IF VFDATA EQ LAYOUT THEN
- *( Note that there are two spaces following the word FLAG on
- the
- second line following this comment. )
- LOAD REPORTS
- .VFNAME "FLAG NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
- NO"
- .VFNAME .VFDATA
- END
- SET VAR LAY TO YES
- ENDIF
- IF LAY EQ NO THEN
- SET VAR TEMP TO " " + .VFDATA
- LOAD REPORTS
- .VFNAME .TEMP
- END
- ENDIF
- ENDIF
- NEXT #2 S2
- ENDWHILE
- SET CLEAR ON
- SET MESSAGE ON
- SET ERROR MESSAGE ON
- QUIT
-
-
-
-
-
-
- MICRORIM TECHNICAL NOTE
- ________________________________________________________
-
- FAST MULTI-SCREEN FORMS
-
-
-
-
-
-
-
-
-
-
-
-
- DATE : 03/86 NUMBER : EX-3-7
- PRODUCT : R5K VERSIONS : 1.01
- CATEGORY : FORMS SUBCATEGORY : MULTI-SCREEN
-
- ________________________________________________________
-
- DESCRIPTION: What is a fast and simple way to have multiple-screen
- data entry forms that use table forms exclusively?
-
-
-
-
- SOLUTION: It is not necessary to use variable forms to simulate
- multiple-screen data entry forms. You can do it faster with table
- forms. RUN the command file ENTRY.CMD, listed below, to control each
- data entry session. This example assumes you have already created the
- two table forms PAGE1 and PAGE2 by using the FORMS command.
-
- *( ENTRY.CMD )
- SET MESSAGES OFF
- SET VAR NUMBER INTEGER
- SET VAR LOOPER TO 1
- NEWPAGE
- FILLIN NUMBER USING "How many two-page forms do you want to enter? "
- WRITE "After entering page one of each form, press [ESC] and then
- press [A]"
- WRITE " "
- WRITE "After entering page two of each form, press [ESC] and then
- press [C]"
- WRITE " "
- WRITE "Press any key to begin this data entry session"
- PAUSE
-
- WHILE LOOPER LE .NUMBER THEN
- ENTER PAGE1 FOR 1 ROW
- EDIT USING PAGE2 WHERE COUNT = LAST
-
- *( If you have more than two pages, repeat the EDIT command line
- listed above and change the form name to PAGE3, PAGE4, etc.)
-
- SET VAR LOOPER TO .LOOPER + 1
- ENDWHILE
-
- If you want the operator to press the same thing after entering both
- pages it will be necessary to modify the above code. The way it is
- now, the operator will need to press [ESC] [A] for page one and [ESC]
- [C] for page two. To modify the code, first load a row that has null
- values for all the rows by inserting the following code as the first
- section in the WHILE loop:
-
- SET NULL -0-
- LOAD TBLNAME
- FILL
- -0-
- END
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Next, change the ENTER command line to the following:
-
- EDIT USING PAGE1 WHERE COUNT = LAST
-
- Now the operator will press [ESC] [C] on both page one and two.
- However, keep in mind that this modification will slow down the
- execution speed.
-